package com.cn;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * @author 伍崇武
 * @date 2021-08-24 0024 - 下午 2:41
 */
@SpringBootApplication
// 开启服务注册与发现
@EnableDiscoveryClient
// 开启Feign
@EnableFeignClients
public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class,args);
    }

    @Bean
    @LoadBalanced   // order服务调用video服务(负载均衡策略在order => 客户端负载均衡)
    public RestTemplate getRestTemplate(){
        return new RestTemplate();
    }
}
